<?php
class Default_Model_Friend extends Zend_Db_Table{

	protected $_name = FRIEND_TABLE;

	private $USER_ID = 'user_id';
	private $FRIEND_ID = 'friend_id';

	protected $db;

	public function __construct(){
		//Goi ket noi voi Zend Db
		$this->db = Zend_Registry::get('connectDB');
	}

	protected $_messageError = null;

	
	// Xoa friend
	public function deleteFriendByUserId($userId){
		try {
			$this->db->delete(FRIEND_TABLE,$this->USER_ID.' = ' . $userId . ' OR ' . $this->FRIEND_ID.' = ' . $userId);
			return true;
		} catch (Exception $e) {
			$this->_messageError = $e->getMessage();
			return false;
		}
	}

	public function getError(){
		return $this->_messageError;
	}
}